package com.gugee.ins.data.task.statistics;

import com.gugee.common.task.dto.TaskParam;
import com.gugee.ins.data.task.constant.TaskType;
import com.gugee.ins.data.task.statistics.service.*;
import com.xiguaji.boot.toolkit.JsonUtil;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class StInsBloggerTask {

    @Autowired
    StBloggerActiveFollowerDataSvc stBloggerActiveFollowerDataSvc;

    @Autowired
    StBloggerRealFollowerSvc stBloggerRealFollowerSvc;

    @Autowired
    StBloggerMediaSvc stBloggerMediaSvc;

    @Autowired
    StBloggerIdenticalLevelSvc stBloggerIdenticalLevelSvc;

    @Autowired
    StProductBaseSvc stProductBaseSvc;

    /**
     * 大播主真实粉丝统计
     * @param params
     * @return
     */
    @XxlJob("sendMBloggerMsg4RealFollowerSt")
    public ReturnT<String> sendMBloggerMsg4RealFollowerSt(String params) {
        TaskParam taskParam = JsonUtil.jsonParse(TaskParam.class, params);
        return stBloggerRealFollowerSvc.xxlJobStart(TaskType.MBLOGGER_ST_4_REAL_FOLLOWER.getValue(),"sendMBloggerMsg4RealFollowerSt",taskParam,false);
    }

    /**
     * 大播主活跃粉丝画像
     * @param params
     * @return
     */
    @XxlJob("sendMBloggerMsg4ActiveFollowerDataSt")
    public ReturnT<String> sendMBloggerMsg4ActiveFollowerDataSt(String params) {
        TaskParam taskParam = JsonUtil.jsonParse(TaskParam.class, params);
        return stBloggerActiveFollowerDataSvc.xxlJobStart(TaskType.MBLOGGER_ST_4_ACTIVE_FOLLOWER_DATA.getValue(),"sendMBloggerMsg4ActiveFollowerDataSt",taskParam,false);
    }

    /**
     * 大播主同等级平均值统计
     * @param params
     * @return
     */
    @XxlJob("sendMBloggerMsg4IdenticalLevelSt")
    public ReturnT<String> sendMBloggerMsg4IdenticalLevelSt(String params) {
        TaskParam taskParam = JsonUtil.jsonParse(TaskParam.class, params);
        return stBloggerIdenticalLevelSvc.xxlJobStart(TaskType.MBLOGGER_ST_4_IDENTICAL_LEVEL_DATA.getValue(),"sendMBloggerMsg4IdenticalLevelSt",taskParam,false);
    }

    /**
     * 大播作品值统计
     * @param params
     * @return
     */
    @XxlJob("sendMBloggerMsg4MediaSt")
    public ReturnT<String> sendMBloggerMsg4MediaSt(String params) {
        TaskParam taskParam = JsonUtil.jsonParse(TaskParam.class, params);
        return stBloggerMediaSvc.xxlJobStart(TaskType.MBLOGGER_ST_4_MEDIA_DATA.getValue(),"sendMBloggerMsg4MediaSt",taskParam,false);
    }

    /**
     * 商品统计
     * @param params
     * @return
     */
    @XxlJob("sendProductMsg4ProductBaseSt")
    public ReturnT<String> sendProductMsg4ProductBaseSt(String params) {
        TaskParam taskParam = JsonUtil.jsonParse(TaskParam.class, params);
        return stProductBaseSvc.xxlJobStart(TaskType.PRODUCT_ST.getValue(),"sendProductMsg4ProductBaseSt",taskParam,false);
    }
}
